#include<bits/stdc++.h>
using namespace std;
#define int long long

int n, m;
int a[100005];


signed main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	sort(a + 1, a + n + 1);

	int ans = 0, cnt = 0;
	int k = 100;
	while (k--) {
		for (int i = 1; i <= n; i++) {
			if (a[i])
				a[i]--, cnt++;
			if (cnt == m)
				cnt = 0, ans++;
		}
	}
	cout << ans;
	return 0;
}
